package com.gxa.admin.controller;

import com.gxa.common.vo.JsonResult;
import com.gxa.common.vo.PageRecv;
import com.gxa.common.vo.ResultVo;
import com.gxa.modules.pojo.Customer;
import com.gxa.modules.pojo.CustomerMap;
import com.gxa.modules.service.CustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/customer")
@Api(value = "客户管理test",tags = "客户管理模板接口API")
public class CustomerController {
    @Autowired
    private CustomerService customerService;
    @ApiOperation(value = "客户管理默认查询",notes = "客户管理默认查询",httpMethod = "post", response = JsonResult.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=300,message="数据类型错误"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @PostMapping(value = "/queryList")
    public JsonResult queryList(@RequestBody PageRecv pageRecv){
        return customerService.queryList(pageRecv);
    }

    @ApiOperation(value = "客户管理指定查询",notes = "客户管理指定查询",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/specificQueryList")
    public JsonResult specificQueryList(@RequestBody CustomerMap customerMap){
        return customerService.specificQueryList(customerMap);
    }
    @ApiOperation(value = "客户管理短信发送",notes = "客户管理短信发送",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/SMS_Send")
    public ResultVo SMS_Send(){
        ResultVo r = new ResultVo();
        r.setCode(200);
        r.setMsg("测试成功");
        return r;
    }
    @ApiOperation(value = "客户按照订单排序",notes = "客户按照订单排序(从多到少)",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/orderSortList")
    public JsonResult orderSortList(@RequestBody PageRecv pageRecv){
        return customerService.orderSortList(pageRecv);
    }
    @ApiOperation(value = "客户按照贷款金额排序",notes = "客户按照贷款金额排序(从多到少)",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/moneySortList")
    public JsonResult moneySortList(@RequestBody PageRecv pageRecv){
        return customerService.moneySortList(pageRecv);
    }
    @ApiOperation(value = "客户按照注册时间排序",notes = "客户按照注册时间排序(从大到小)",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/timeSortList")
    public JsonResult timeSortList(@RequestBody PageRecv pageRecv){
        return customerService.timeSortList(pageRecv);
    }
    @ApiOperation(value = "客户按照会员等级排序",notes = "客户按照会员等级排序(从多到少)",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/gradeSortList")
    public JsonResult memberGradeSortList(@RequestBody PageRecv pageRecv){
        return customerService.memberGradeSortList(pageRecv);
    }
    @ApiOperation(value = "查看客户信息",notes = "查看客户信息",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/seeCustomer")
    public JsonResult seeCustomer(@RequestBody Customer customer){
        return customerService.seeCustomer(customer.getId());
    }
    @ApiOperation(value = "查看客户详细信息",notes = "查看客户详细信息",httpMethod = "post", response = JsonResult.class)
    @PostMapping(value = "/seeCustomerSpecific")
    public JsonResult seeCustomerSpecific(@RequestBody Customer customer){
        return customerService.seeCustomerSpecific(customer.getId());
    }
}
